package com.zego.wawaji.ui.center.invite.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONObject;

/**
 * Created by Su on 2018/4/2.
 */
public class Invite extends BaseData implements Parcelable {
    private int inviteBox = -1;  // -1:不可打开  0：已打开  1： 可打开
    private String inviteContent;
    private int inviteDailyNum;
    private int inviteNum;
    private String inviteSuccess;
    private String shareCircle;
    private String shareContent;
    private String shareFriends;
    private String inviteSuccessRed;  // 邀请需变色字段
    private String sendContent;

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);

        this.inviteBox = jsonObject.optInt("InviteBox");
        this.inviteContent = jsonObject.optString("InviteContent");
        this.inviteDailyNum = jsonObject.optInt("InviteDailyNum");
        this.inviteNum = jsonObject.optInt("InviteNum");
        this.inviteSuccess = jsonObject.optString("InviteSuccess");
        this.shareCircle = jsonObject.optString("ShareCircle");
        this.shareContent = jsonObject.optString("ShareContent");
        this.shareFriends = jsonObject.optString("ShareFriends");
        this.inviteSuccessRed = jsonObject.optString("InviteSuccessRed");
        this.sendContent = jsonObject.optString("SendContent");
    }

    public String getSendContent() {
        return sendContent;
    }

    public String getInviteSuccessRed() {
        return inviteSuccessRed;
    }

    public int getInviteBox() {
        return inviteBox;
    }

    public void setInviteBox(int inviteBox){
        this.inviteBox = inviteBox;
    }

    public String getInviteContent() {
        return inviteContent;
    }

    public int getInviteDailyNum() {
        return inviteDailyNum;
    }

    public int getInviteNum() {
        return inviteNum;
    }

    public String getInviteSuccess() {
        return inviteSuccess;
    }

    public String getShareCircle() {
        return shareCircle;
    }

    public String getShareContent() {
        return shareContent;
    }

    public String getShareFriends() {
        return shareFriends;
    }

    public Invite() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.inviteBox);
        dest.writeString(this.inviteContent);
        dest.writeInt(this.inviteDailyNum);
        dest.writeInt(this.inviteNum);
        dest.writeString(this.inviteSuccess);
        dest.writeString(this.shareCircle);
        dest.writeString(this.shareContent);
        dest.writeString(this.shareFriends);
        dest.writeString(this.inviteSuccessRed);
        dest.writeString(this.sendContent);
    }

    protected Invite(Parcel in) {
        this.inviteBox = in.readInt();
        this.inviteContent = in.readString();
        this.inviteDailyNum = in.readInt();
        this.inviteNum = in.readInt();
        this.inviteSuccess = in.readString();
        this.shareCircle = in.readString();
        this.shareContent = in.readString();
        this.shareFriends = in.readString();
        this.inviteSuccessRed = in.readString();
        this.sendContent = in.readString();
    }

    public static final Creator<Invite> CREATOR = new Creator<Invite>() {
        @Override
        public Invite createFromParcel(Parcel source) {
            return new Invite(source);
        }

        @Override
        public Invite[] newArray(int size) {
            return new Invite[size];
        }
    };
}
